<?php
/* -----------------------------------------------------------------
 *                        Aveghe My Blog
 * -----------------------------------------------------------------
 * Aveghe My Blog: made your blog easy!
 * Copyright (C) 2008 Elia Contini
 * 
 * Aveghe My Blog is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * Aveghe My Blog is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

$baseURL = BASE_URL;

$meta    = $this->head('meta'   , 'public', $this->preferences);
$style   = $this->head('style'  , 'public', $this->preferences);
$favicon = $this->head('favicon', 'public', $this->preferences);
$rss     = $this->head('rss'    , 'public', $this->preferences);

$siteTitle = '<h1><a href="'.$baseURL.'/" title="">'.stripcslashes($this->preferences['site_title'])."</a></h1>\n";

$report = '';
$content  = "\r<h2 class=\"postTitle\">".stripcslashes($this->file['document_name'])."</h2>\n";
$content .= '<div class="postText">'.stripcslashes($this->file['document_content'])."</div>\n";
$content .= "\t<p class=\"tags\"><strong>Etichette</strong>: ".$this->file['document_keywords']."</p>\n";
//$content .= '<p class="postInfo">Scritto da <a href="#'.$this->file['user_id'].'" title="">'.$this->file['user_name'].' '.$this->file['user_surname'].'</a> il ';
$content .= '<p class="postInfo">Scritto da '.$this->file['user_name'].' '.$this->file['user_surname'].' il ';
$content .= $this->formatDateTime($this->file['document_creation_date'])."</p>\n";

if($this->preferences['site_comments'] != 'disable' && $this->file['document_comments_enable'])
	{
		$content .= '<a id="comments"></a>';
		
		if(count($this->comments) > 0)
			{
				foreach($this->comments as $comment)
					{
						$content .= "\n<h3 class=\"commentInfo\">";
						if($comment['comment_author_website'] != '')
							$content .= '<a href="'.$comment['comment_author_website'].'" title="Sito Web di '.$comment['comment_author'].'">'.$comment['comment_author'].'</a> il '.$this->formatDateTime($comment['comment_date']).' ha scritto:';
						else
							$content .= $comment['comment_author'].' il '.$this->formatDateTime($comment['comment_date']).' ha scritto:';
						$content .= "</h3>\n";
						$content .= '<div class="commentText">'.stripcslashes($comment['comment_text']).'</div>';
					}
			}
		
		$content .= $this->commentForm($this->file['document_id'], $this->report, $this->validationResult);
	}

$categories = $this->categoriesList($this->categories, $this->currentCategory);

include 'aveghe/themes/public/'.$this->preferences['site_public_theme'].'/template_public.xhtml';
?>